from collections import namedtuple

Event = namedtuple("Event","time ident action")

def taxi_process(trips,start_time,ident):
    time = yield Event(start_time,ident,'begin')
    for i in range(trips):
        time = yield Event(time,ident,'up person')
        time = yield Event(time, ident, 'down person')
    yield Event(time, ident, 'over')

def print_msg(time,ident,action):
    print('time:{},taxi_num:{},action {}'.format(time, ident, action))


x = taxi_process(3,3,8888)
time,ident,action = next(x)
print_msg(time,ident,action)
for i in range(6):
    next_time = time + 3
    time, ident, action = x.send(next_time)
    print_msg(time, ident, action)
next_time = time + 3
time, ident, action = x.send(next_time)
print_msg(time, ident, action)



